package com.wzy.projectManagement.module
{
	import com.adobe.cairngorm.model.ModelLocator;
	
	import mx.collections.ArrayCollection;

	public class ProjectModel implements ModelLocator
	{
		
		public static var instance : ProjectModel = null;
		public var main : index;
		[Bindable]
		public var acProject : ArrayCollection = new ArrayCollection();
		
		public var objProject : Object = new Object();
		
		public static function getInstance() : ProjectModel {
			if(instance == null) {
				instance = new ProjectModel();
			}
			return instance;
		}
		
		public function getCurrentProject(projectId : String) : Object {
			var acTemp : ArrayCollection = objProject.VALUE;
			var objRe : Object = null;
			if(acTemp != null) {
				for(var i : int = 0;i < acTemp.length;i++) {
					if(acTemp.getItemAt(i).projectId == projectId) {
						objRe = acTemp.getItemAt(i);
						break;
					}
				}
			} 
			return objRe;
		} 
		
	}
}